package net.lzzy.algorithm.algorlib;

public class SortFactory {
    public static <T extends Comparable<? super T>> BaseSort<T> getInstance(int key,T[] items){
        BaseSort sort;
        switch (key){
            case 1:
               sort= new DirectSort<>(items);
               break;
            case 2:
                sort=new InsertSort<>(items);
                break;
            case 3:
                sort=new ShellSort<>(items);
                break;
            case 4:
                sort=new BubbleSort<>(items);
                break;
                default:
                    return null;
        }
        return sort;
    }
    public static String[] getsortName(){
        return new  String[]{"选择排序方法","直接选择排序","直接插入排序","希尔排序","冒泡排序"};
    }
}
